package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrOutcupEfficiencySummaryService;
import com.yunhai.model.entity.orr.OrrOutcupEfficiencySummaryEntity;
import com.yunhai.model.vo.orr.OrrOutcupEfficiencySummaryQuery;
import com.yunhai.model.vo.orr.OrrOutcupEfficiencySummaryVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrOutcupEfficiencySummary")
public class OrrOutcupEfficiencySummaryController {

	@Resource
	private OrrOutcupEfficiencySummaryService orrOutcupEfficiencySummaryService;


	/**
	 * 获取 OrrOutcupEfficiencySummary 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrOutcupEfficiencySummaryPagination(PaginationVo paginationVo, OrrOutcupEfficiencySummaryQuery orrOutcupEfficiencySummaryQuery ) throws Exception {
		IPage page = orrOutcupEfficiencySummaryService.getOrrOutcupEfficiencySummaryPagination(paginationVo, orrOutcupEfficiencySummaryQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrOutcupEfficiencySummary 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrOutcupEfficiencySummaryAllList( OrrOutcupEfficiencySummaryQuery orrOutcupEfficiencySummaryQuery ) throws Exception {
		List<OrrOutcupEfficiencySummaryEntity> list = orrOutcupEfficiencySummaryService.getOrrOutcupEfficiencySummaryAllList( orrOutcupEfficiencySummaryQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrOutcupEfficiencySummary 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrOutcupEfficiencySummaryDetailById(@PathVariable Long id) throws Exception {

	    OrrOutcupEfficiencySummaryEntity orrOutcupEfficiencySummaryEntity = orrOutcupEfficiencySummaryService.getOrrOutcupEfficiencySummaryDetail(id);
		return Ret.ok(orrOutcupEfficiencySummaryEntity);
	}


	/**
	 * 新增 OrrOutcupEfficiencySummary
	 * */
	@PostMapping("")
	public Ret addOrrOutcupEfficiencySummary(@RequestBody OrrOutcupEfficiencySummaryVo orrOutcupEfficiencySummaryVo) throws Exception {

		orrOutcupEfficiencySummaryService.addOrrOutcupEfficiencySummary(orrOutcupEfficiencySummaryVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrOutcupEfficiencySummary
	 * */
	@PutMapping("")
	public Ret updateOrrOutcupEfficiencySummary(@RequestBody OrrOutcupEfficiencySummaryVo orrOutcupEfficiencySummaryVo) throws Exception {

		orrOutcupEfficiencySummaryService.updateOrrOutcupEfficiencySummary(orrOutcupEfficiencySummaryVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrOutcupEfficiencySummary
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrOutcupEfficiencySummary( @RequestBody List<Long> ids ) throws Exception {

	    orrOutcupEfficiencySummaryService.batchRemoveOrrOutcupEfficiencySummary(ids);
		return Ret.ok();
	}
}
